package derivable;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

public class Conjunction implements Derivable<Conjunction> {
	private List<Proposition> propositions = new ArrayList<>();

	public Conjunction(final List<Proposition> propositions) {
		this.propositions = propositions;
	}
	public Conjunction(final Proposition... propositions) {
		final List<Proposition> list = new ArrayList<>();
		Collections.addAll(list, propositions);
		this.propositions = list;
	}
	@Override
	public boolean derives(final Conjunction o) {
		for (final Proposition own : getPropositions()) {
			for (final Proposition other : o.getPropositions()) {
				if (own.derives(other)) {
					return true;
				}
			}
		}
		return false;
	}
	public List<Proposition> getPropositions() {
		return propositions;
	}
	public void setPropositions(final List<Proposition> propositions) {
		this.propositions = propositions;
	}
}
